<template>
    <div class="exam-wrap">
        <div class="main clearfix">
            <p class="title">{{orgname}}</p>
            <mt-field label="账号：" placeholder="请输入账号" v-model="form.common_account"></mt-field>
            <mt-field label="密码：" placeholder="请输入密码" type="password" v-model="form.common_password"></mt-field>
        </div>
        <div class="btn-box">
            <mt-button type="danger" @click="cancel" size="large">取消</mt-button>
            <mt-button type="primary" @click="submit" size="large">确定</mt-button>
        </div>

    </div>
</template>

<style>
    .unit_name{
        text-align: center;
        height: 22px;
        font-size: 18px;
    }
    .main{
        padding: 0px 15px;
    }
    .title{
        font-size: 16px;
        padding: 10px 15px 15px;
        text-align: center;
    }
    .test-main{
        width: 90%;
    }
    .btn-box{
        text-align: center;
        padding-top: 30px;
    }
    .btn-box button{
        width: 42%;
        display: inline-block;
        margin: 0 2%;
    }
</style>

<script>
    import conf from '../config/userconf.js'
    export default {
        name:"transfer",
        data() {
            return {
                form: {
                    common_account: '',
                    common_password: '',
                },
                orgname: '',

            };
        },
        methods: {
            init(){
                
                console.log(window.localStorage.orgname);
                this.orgname = window.localStorage.orgname;
                
            },
            submit(data=Object()){
                console.log(this.form.common_account,this.form.common_password);
                if(!this.form.common_account){

                    this.$toast('请输入账号');
                    return;
                }
                if(!this.form.common_password){

                    this.$toast('请输入密码');
                    return;
                }
                
                data = this.form;
                conf.exams.organizationmove(data,(state,res)=>{
                    if (state == 'success'&&res.data.status == 1){
                        console.log(res.data);

                        this.$toast(res.data.message);
                        
                    }else if(state == 'success'&&res.data.status != 1){
                        this.$toast(res.data.message);
                    }
                })

            },
            cancel(){
                this.$router.back(-1);
            },
            
        },
        mounted (){
            this.init();
            document.title = "单位迁移";
        },
    }
</script>